using NHibernate;
using NHibernate.Criterion;
using Web.App.Infrastructure.NHibernate.Fetching;

namespace Webshop20.Infrastructure.Persistence.NH.FetchingStrategies
{
    public class OrderInCalculationFetchingStrategy : IFetchingStrategy<Order>
    {
        public ICriteria ApplyFetchingStrategy(ICriteria criteria)
        {
            criteria.SetFetchMode("Positions", FetchMode.Eager);
            criteria.SetFetchMode("Positions.Product", FetchMode.Eager);
            return criteria;
        }
    }
}